<?php
my_component_load('list_kalender' , false);
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('pengantian_karyawan');
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0; 

$modulname = "Kesejahteraan _BN_ Fasilitas Kesehatan _BN_ Reimburstment";

if($_SERVER['REQUEST_METHOD'] == "POST" ): 
	switch($task){
		case   "edit_penggantian" :
			end($_POST); $valid_post=key($_POST); 
			$validatepost = valid_penggantian($id);
			if($validatepost){
				$pagename = ($id>0)? " Perubahan Data" :"Tambah Data";
				$content = message_multi_error($validatepost); 
				$content .=form_penggantian($id,$valid_post,false);
			}else{
				if($valid_post=="submit"){
					submit_penggantian($id);
					my_direct('index.php?com='.$_GET['com']);
				}else{
					$content = form_penggantian($id,$valid_post,true);	
				}		
			}
//			generate_my_web($content, $pagename ,"plain.php");
//			exit;				
			break; 
	}
	
 
else:
 	if($task == "edit_penggantian"){
		$pagename = ($id>0)? " Perubahan Data" :  "Tambah Data";
		$content  = form_penggantian($id,'',false);
	}elseif($task=='delete'){ 	
		delete_penggantian($id);
		my_direct('index.php?com='.$_GET['com']);
	}elseif($task == "cetak_penggantian"){
		@ob_end_clean(); 
		echo'<pre>';
		echo cetak_penggantian($id);
		exit;		
		
	}else{
		$pagename = $modulname ; 
		load_facebox_script();
		$content =list_penggantian();
	}
endif; 
generate_my_web($content, $pagename  );
?>